import React from 'react';
import { subRoutes } from '@/router'
import { Route, Switch } from 'react-router-dom'
import UserPage from '@/views/user-page'

let arr = []
subRoutes.forEach((item) => {
  arr = [...arr, ...item.children]
})

function App() {
  return (
    <div className="App">
      <UserPage>
        <Switch>
          {
            arr.map(node => {
              const { path, component,exact } = node
              return <Route key={path} path={path} component={component} exact={exact} />
            })
          }
          {/* 设置默认进入的页面 */}
        </Switch>
      </UserPage>
    </div>
  );
}

export default App;
